package Streamer;

import java.util.Observable;

public class Timer extends Observable implements Runnable
{
	private boolean keepRunning;
	private int milliSeconds;
	
	public Timer(int milliSeconds)
	{
		this.milliSeconds = milliSeconds;
		this.keepRunning = true;
	}
	
	public void run()
	{
		try 
		{
			while(keepRunning)
			{
				Thread.sleep(milliSeconds);
				setChanged();
				notifyObservers("Timer");
			}
		} 
		
		catch (InterruptedException e){}
	}
	
	public void stopThread()
	{
		keepRunning = false;
	}
}
